package kr.pe.johnkim.app.mobile.rest.service;

import kr.pe.johnkim.app.domain.MyHistoryItem;
import kr.pe.johnkim.app.mobile.rest.dao.MyHistoryItemDao;
import kr.pe.johnkim.app.mobile.rest.dao.MyHistoryItemDaoImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @author : johnkim <cale9797@gmail.com / Bettersoft Inc,.>
 * @Date : 12. 2. 6
 */
public class MyHistoryItemServiceImpl implements MyHistoryItemService {
    // SLF4J Logging
	private Logger logger = LoggerFactory.getLogger(MyHistoryItemServiceImpl.class);
    
    /**
     * 아이템 중복 등록을 확인 한다.
     *
     * @param myHistoryItem
     * @return MyHistoryItem
     */
    @Override
    public MyHistoryItem checkDuplication(MyHistoryItem myHistoryItem) {
        logger.info("checkDuplication");
        return myHistoryItemDao.checkDuplication(myHistoryItem);
    }

    /**
     * 아이템을 등록 한다.
     *
     * @param myHistoryItem
     * @return
     */
    @Override
    public boolean registerItem(MyHistoryItem myHistoryItem) {
        logger.info("registerItem");
        return myHistoryItemDao.registerItem(myHistoryItem);
    }

    /**
     * 아이템 내용을 가져 온다.
     *
     * @param myHistoryItem
     * @return
     */
    @Override
    public MyHistoryItem selectItem(MyHistoryItem myHistoryItem) {
        logger.info("selectItem");
        return myHistoryItemDao.selectItem(myHistoryItem);
    }

    /**
     * 아이템 목록을 가져 온다.
     *
     * @param myHistoryItem
     * @return List<MyHistoryItem>
     */
    @Override
    public List<MyHistoryItem> selectItemList(MyHistoryItem myHistoryItem) {
        logger.info("selectItemList");
        return myHistoryItemDao.selectItemList(myHistoryItem);
    }

    /**
     * Category 의 아이템 목록을 가져 온다.
     *
     * @param myHistoryItem
     * @return
     */
    @Override
    public List<MyHistoryItem> selectItemListForCategory(MyHistoryItem myHistoryItem) {
        logger.info("selectItemListForCategory");
        return myHistoryItemDao.selectItemListForCategory(myHistoryItem);
    }

    /**
     * 아이템 내용을 수정 한다.
     *
     * @param myHistoryItem
     * @return True or False
     */
    @Override
    public boolean updateItem(MyHistoryItem myHistoryItem) {
        logger.info("updateItem");
        return myHistoryItemDao.updateItem(myHistoryItem);
    }

    /**
     * 아이템을 비활성화 한다.
     *
     * @param myHistoryItem
     * @return
     */
    @Override
    public boolean updateDeactivateItem(MyHistoryItem myHistoryItem) {
        logger.info("updateDeactivateItem");
        return myHistoryItemDao.updateDeactivateItem(myHistoryItem);
    }

    /**
     * Spring Setter Injection.
     */
    private MyHistoryItemDao myHistoryItemDao;

    public void setMyHistoryItemDao(MyHistoryItemDaoImpl myHistoryItemDao) {
        this.myHistoryItemDao = myHistoryItemDao;
    }
}
